/*
 * Copyright 2017-2020 original authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.micronaut.kotlin.processing.beans.executable

import io.micronaut.context.annotation.Executable
import jakarta.inject.Inject

@Executable
class BookController {

    @Inject
    lateinit var bookService: BookService

    @Executable
    fun show(id: Long?): String {
        return String.format("%d - The Stand", id)
    }

    @Executable
    fun showArray(id: Array<Long?>): String {
        return String.format("%d - The Stand", id[0])
    }

    @Executable
    fun showPrimitive(id: Long): String {
        return String.format("%d - The Stand", id)
    }

    @Executable
    fun showPrimitiveArray(id: LongArray): String {
        return String.format("%d - The Stand", id[0])
    }

    @Executable
    fun showVoidReturn(jobNames: MutableList<String?>) {
        jobNames.add("test")
    }

    @Executable
    fun showPrimitiveReturn(values: IntArray): Int {
        return values[0]
    }
}
